<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>flex五栏垂直居中布局</title>
</head>

<body>
    <div class="box">
        <div class="content">
            1
        </div>
        <div class="content">
            2
        </div>
        <div class="content">
            3
        </div>
        <div class="content">
            4
        </div>
        <div class="content">
            5
        </div>
    </div>
    <style>
        .box {
            display: flex;
            /*两端居中对齐,仅包含子元素*/
            justify-content: space-between;
            /*垂直居中,仅包含子元素*/
            align-items: center;
        }

        .content {

            /*均分*/
            flex-grow: 1;
            text-align: center;
        }

        /*奇数*/
        .box :nth-child(odd) {
            background-color: tomato;
        }

        /*偶数*/
        .box :nth-child(even) {
            background-color: teal;
        }
    </style>

</body>

</html>